From 448ea5b78e22ae25b0a2cdf1c2337fa6399c26ff Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 21 Jul 2005 13:59:49 +0000 Subject: [PATCH] Save per cpu IDT information into the VMCS host area. Without this, we may be saving the IDT info from the wrong cpu into the vmcs. This makes domU work in the presence of VMX domains on SMP/HT enabled machines. Signed-off-by: Chengyuan Li Signed-off-by: Xiaofeng Ling =20 Signed-off-by: Arun Sharma --- xen/arch/x86/vmx_vmcs.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/vmx_vmcs.c b/xen/arch/x86/vmx_vmcs.c index 116a5c5133..a8a01c7808 100644 --- a/xen/arch/x86/vmx_vmcs.c +++ b/xen/arch/x86/vmx_vmcs.c @@ -190,10 +190,14 @@ void vmx_do_launch(struct vcpu *v) vmx_setup_platform(v, regs); + __asm__ __volatile__ ("sidt (%0) \n" :: "a"(&desc) : "memory"); + host_env.idtr_limit = desc.size; + host_env.idtr_base = desc.address; + error |= __vmwrite(HOST_IDTR_BASE, host_env.idtr_base); + __asm__ __volatile__ ("sgdt (%0) \n" :: "a"(&desc) : "memory"); host_env.gdtr_limit = desc.size; host_env.gdtr_base = desc.address; - error |= __vmwrite(HOST_GDTR_BASE, host_env.gdtr_base); error |= __vmwrite(GUEST_LDTR_SELECTOR, 0); @@ -351,7 +355,6 @@ static inline int construct_vmcs_host(struct host_execution_env *host_env) { int error = 0; unsigned long crn; - struct Xgt_desc_struct desc; /* Host Selectors */ host_env->ds_selector = __HYPERVISOR_DS; @@ -377,14 +380,7 @@ static inline int construct_vmcs_host(struct host_execution_env *host_env) host_env->ds_base = 0; host_env->cs_base = 0; -/* Debug */ - __asm__ __volatile__ ("sidt (%0) \n" :: "a"(&desc) : "memory"); - host_env->idtr_limit = desc.size; - host_env->idtr_base = desc.address; - error |= __vmwrite(HOST_IDTR_BASE, host_env->idtr_base); - __asm__ __volatile__ ("mov %%cr0,%0" : "=r" (crn) : ); - host_env->cr0 = crn; error |= __vmwrite(HOST_CR0, crn); /* same CR0 */ @@ -392,6 +388,7 @@ static inline int construct_vmcs_host(struct host_execution_env *host_env) __asm__ __volatile__ ("mov %%cr4,%0" : "=r" (crn) : ); host_env->cr4 = crn; error |= __vmwrite(HOST_CR4, crn); + error |= __vmwrite(HOST_RIP, (unsigned long) vmx_asm_vmexit_handler); #ifdef __x86_64__ /* TBD: support cr8 for 64-bit guest */ -- 2.30.2